const util = require('../utils/util.js');
const api = require('../config/api.js');

function list(data, callback) {
    util.request(api.commoditys, data, 'GET', (res) => {
        typeof callback == "function" && callback(res)
    })
}

function info(id, callback) {
    util.request(api.commodity + id, {}, 'GET', (res) => {
        typeof callback == "function" && callback(res)
    })
}

function hs(data, callback) {
    util.request(api.hs, data, 'GET', (res) => {
        typeof callback == "function" && callback(res)
    })
}

function search(data, callback) {
    util.request(api.search, data, 'GET', (res) => {
        typeof callback == "function" && callback(res)
    })
}

module.exports = {
    list,
    hs,
    info,
    search,
};
